﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page isELIgnored="false" %> 

<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@page import="net.ssta.core.web.RequestKit"%>
<%@ page import="net.ssta.core.db.PagingInfo"%>

<%
	String path = request.getContextPath();
	//分页参数
    PagingInfo pagingInfo =(PagingInfo) request.getAttribute("pagingInfo");
    int pageno = pagingInfo.getCurrentPageNo();
    
    Record searchRcd = (Record) request.getAttribute("searchRcd");
    
    //科技成果信息列表
    RecordSet expertInfoSet = (RecordSet) request.getAttribute("expertInfoSet");
    
    //性别
    RecordSet sex = (RecordSet) request.getAttribute("sex");
    
    //性别
    RecordSet provinceSet = (RecordSet) request.getAttribute("provinceSet");
    
    //代码、值Map
    Map fildOptionMap =  (HashMap)request.getAttribute("fildOptionMap");
    
     //省份代码Map
    Map provinceMap =  (HashMap)request.getAttribute("provinceMap");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<link type="text/css" rel="stylesheet" href="<%=path%>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/ostable.css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/tab.css" />
<link rel="stylesheet" href="<%=path%>/includes/lhgdialog/lhgdialog.css" />



<script type='text/javascript' src="<%=path%>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/includes/styleBase/js/style.js"></script>
<script type="text/javascript" src="<%=path%>/includes/DatePicker/WdatePicker.js"></script>


<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgdialog.js"></script>

<title>科研专家照片维护</title>
 
<script type="text/javascript">
$("document").ready(function()
{
	 
}); 

function moreSearch()
{
	$('#more').show();
	$('#more1').show();
	$('#moreButton').hide();
	$('#lessButton').show();
}

function lessSearch()
{
	$('#more').hide();
	$('#more1').hide();
	$('#moreButton').show();
	$('#lessButton').hide();
}

function handle()
{
	
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	var dlg = new J.ui.dialog({ id:'handlekjcgdemand',
		                         title:'处理项目需求',
		                         range:true,
		                         btns:true,
		                         page:'<%=path%>/back/userNeeds/HandleKjcgNeeds.jsp?kjcgUuids='+pids,
		                         width:700,
		                         height:400,
		                         windowObj:window});
	dlg.ShowDialog();
}




function onHandle()
{
	
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
     $.ajax({
			type: "POST", url: "<%=path%>/back/UserNeedsManage?method=unHandKjcgNeeds&kjcgUuids="+pids,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("操作成功!");
				_goPage(<%=pageno%>);
			}
	 });
	
}



function deleteKjcgNeed()
{
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	
	$.ajax({
			type: "POST", url: "<%=path%>/back/UserNeedsManage?method=deleteKjcgUserNeeds&kjcgUuids="+pids,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("操作成功!");
				_goPage(<%=pageno%>);
			}
	 });
}





function changeExpertStatus(fieldname,status){
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	$.ajax({
			type: "POST", url: "<%=path%>/back/InfoRecommend?method=changeExpertStatus&expertUuids="+pids+"&fieldName="+fieldname+"&status="+status,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("操作成功!");
				_goPage(<%=pageno%>);
			}
	 });
}



function doSearch()
{
	var form = document.getElementById("seaForm");
	form.submit();
}

//跳转
function reloadPage() 
{
	_goPage(<%=pageno%>);
}


function _selectall(){
	var uuids = document.getElementsByName("uuids");
	if(uuids.length){
		for(var i=0;i<uuids.length;i++){
			uuids[i].checked = document.getElementById("selectall").checked;
		}
	}
}


function setSortNum(tableName,uuidFiledName,uuid,sortField,obj){
	//alert(uuid+" sortNum:"+$(obj).val());
	var sortNum = $(obj).val();
	
	for(var i=0; i<sortNum.length; i++) {
		if(sortNum.charCodeAt(i)<48 || sortNum.charCodeAt(i)>57){
             $(obj).val("");
             alert("请输入数字!");
             return;
		}
	}
	
	$.ajax({
			type: "POST", url: "<%=path%>/back/InfoRecommend?method=setSortNum&tableName="+tableName+"&uuidFiledName="+uuidFiledName+"&uuid="+uuid+"&sortField="+sortField+"&sortNum="+sortNum,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				//alert("操作成功!");
				doSearch();
			}
	 });
}



function viewExpert(expId,expName)
{
	var dlg = new J.ui.dialog(
	{ id:'handledemand',
         title:'科研专家详细信息',
         range:true,
         btns:true,
         page:'<%=path%>/expert/infoForBack.jsp?expid='+expId+'&title='+expName,
         width:600,
         height:500,
         windowObj:window
       });
	dlg.ShowDialog();
}




function editExpertPhoto(expId,expName)
{
	var dlg = new J.ui.dialog(
	{ id:'handledemand',
         title:'科研专家照片维护',
         range:true,
         btns:true,
         page:'<%=path%>/expert/EditExpertPhoto.jsp?expid='+expId+'&title='+expName,
         width:600,
         height:500,
         windowObj:window
       });
	dlg.ShowDialog();
}



</script>

</head>
<body>
<form id="seaForm" name="seaForm" method="post" action="<%=path%>/back/InfoRecommend?method=ExpertPhotoMaintainList" >
	<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left">&nbsp;</td>
      <td class="box_top_center">科研专家照片维护</td>
      <td class="box_top_right">&nbsp;</td>
    </tr>
  </table>
</div>
<div class="infoDiv">
  <table border="0" cellpadding="0" cellspacing="0" class="trHeightTable">
    <tr>
      <td class="leftTipArea">专家姓名</td>
      <td><input id="keyword" name="keyword" value="<%=searchRcd.getString("KEYWORD","")%>" class="textInput" style="width:120px;"/></td>
      <td class="leftTipArea">从事专业</td>
	  <td>
      
	  	<input id="WORKSPECIALITY" name="WORKSPECIALITY" value="<%=searchRcd.getString("WORKSPECIALITY","")%>" class="textInput" style="width:120px;"/>
      </td>
      <td class="leftTipArea">所在单位</td>
      <td>
      	<input id="keyword" name="UNIT_NAME" value="<%=searchRcd.getString("UNIT_NAME","")%>" class="textInput" style="width:120px;"/>
  	  </td>
  	  <td style="width:20px;"></td>
  	  <td>
  	  	<a href="javascript:doSearch();" class="imgButton"><span>查询</span></a>
  	  </td>
    </tr>
    
  </table>
</div>

</form>

<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left" width="2">&nbsp;</td>
      <td class="box_top_center">查询结果列表</td>
      <td class="box_top_right" width="2">&nbsp;</td>
    </tr>
  </table>
</div>

<div class="contentBox">
    <table class="osTable" cellpadding="0" cellspacing="0" border="0" style="width:100%;">
      <thead>
        <tr >
          <!--  
          <th  width="8%"><input type="checkbox" id="selectall" name="selectall" onclick="javascript:_selectall();" value=""/>选择</th>
          -->
          <th  width="9%">专家姓名</th>
          <th  width="5%">性别</th>
          <th  width="24%">现从事专业</th>
          <th  width="24%">所在单位</th>
          <th  width="10%">地区</th>
          <th  width="23%">照片维护</th>
          <th  width="1%"></th>
        </tr>
      </thead>
      <tbody>
      	<%
      	int i=0;
      	for(i=0;i<expertInfoSet.size();i++){
      		Record expertRecord = expertInfoSet.get(i);
      		String showStr="";
      	%>
	        <tr >
	          <!--
	          <td><input type="checkbox" name="uuids" value="<%=expertRecord.getString("EXPERTID","")%>"/></td>
	           -->
	          <td><a href="#" onclick="viewExpert('<%=expertRecord.getString("EXPERTID","")%>','<%=expertRecord.getString("ITEM_180","")%>');"><%=expertRecord.getString("ITEM_180","")%></a></td>
	          <td >
		         <%
	          	  	 
	          		 showStr=expertRecord.getString("ITEM_181","");
			         if(!expertRecord.getString("ITEM_181","").equals("")){
		          	 	showStr = (String)fildOptionMap.get("ITEM_181"+expertRecord.getString("ITEM_181",""));
		          	 }
	          	 %>
	             <%=showStr%>
	          </td>
	          <td >
	          	 <%=expertRecord.getString("WORKSPECIALITY","")%>
	          </td>
	          <td >
	          	 <%=expertRecord.getString("UNIT_NAME","")%>
	          </td>
	          <td >
	          	 <%=provinceMap.get(expertRecord.getString("ITEM_DQDM",""))==null?"":provinceMap.get(expertRecord.getString("ITEM_DQDM",""))%>
	          	 
	          </td>
	          <td>
	          		<a href="#" onclick="editExpertPhoto('<%=expertRecord.getString("EXPERTID","")%>','<%=expertRecord.getString("ITEM_180","")%>');">维护</a>
	          </td>
	          <td>
	          </td>
	        </tr>
	        <%}
	        
	         for(int j=0;j<pagingInfo.getPageSize()-expertInfoSet.size();j++){ %>
					<tr>
						<!--
						<td>&nbsp;</td>
						-->
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
				<%
			}%>
      </tbody>
    </table>
    
	<div class="navDiv">
		<!-- 
	    <div class="navLeftDiv">
		    <a href="javascript:changeExpertStatus('CHANNELSHOW','1');" class="imgButton" ><span>专家照片维护</span></a>
	    </div>
	     -->
	     <div  class="navRightDiv">
			<jsp:include flush="true" page="/common/paging.jsp"></jsp:include>
		</div>
	</div>
</div>

</body> 
</html>